<template>
	<view class="page">
		<view class="card u-flex">
			<view class="info">
				<view class="num1">客服电话</view>
				<view class="num2">{{info.phone}}</view>
			</view>
			<view class="call" @click="callPhone">拨打</view>
		</view>
		<view class="card u-m-t-30">
			<view class="title">客服微信</view>
			<view class="qr-code">
				<image :src="imgUrl(info.wechat)" @click="showImg"></image>
			</view>
			<view class="tips">扫描二维码添加客服微信</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:''
			}
		},
		methods: {
			getInfo(){
				this.$u.post('/api/baseconfig/kefu').then(res=>this.info = res)
			},
			callPhone(phone){
				uni.makePhoneCall({
					phoneNumber:this.info.phone
				})
			},
			showImg(){
				let url = this.imgUrl(this.info.wechat)
				this.$app.showImg([url])
			}
		},
		onLoad() {
			this.getInfo()
		}
	}
</script>

<style lang="scss">
	.page{padding: 30rpx;}
	.card{box-shadow: 0 0 10rpx #ddd;border-radius: 20rpx;padding: 30rpx 40rpx;
		.info{margin-right: auto;padding: 20rpx 0;
			.num1{color: #666;}
			.num2{font-size: 36rpx;}
		}
		.call{background-color: $tc;border-radius: 100rpx;color: #fff;padding: 8rpx 30rpx;margin-right: 30rpx;font-size: 24rpx;}
		
		.title{color: #666;padding-bottom: 30rpx;}
		.tips{color: #666;text-align: center;padding: 20rpx;}
		.qr-code{text-align: center;padding-top: 20rpx;
			image{width: 300rpx;height: 300rpx;}
		}
		
	}
</style>
